package com.itheima.pattern.flyweight;

public class Client {
    public static void main(String[] args) {
        BoxFactory instance = BoxFactory.getInstance();
        AbstractBox box1 = instance.getBox("L");
        box1.display("red");

        AbstractBox box2 = instance.getBox("I");
        box2.display("red");

        AbstractBox box3 = instance.getBox("O");
        box3.display("black");


        AbstractBox box4 = instance.getBox("L");
        box4.display("blue");

        System.out.println("颜色相同"+(box1==box2));
        System.out.println("形状形同"+(box1==box4));
    }
}
